import axios from 'axios';
import config from "@/util/config.js";

const API_URL = config.wmUrl+'/wm/ware/area/set';

const wareAreaSetAPI = {
    //添加
    addWareAreaSet(param, callback) {
        axios.post(API_URL + '/add', param).then(res => {
            callback(res.data);
        });
    },
    //删除
    deleteWareAreaSet(param, callback) {
        axios.request({
            url: API_URL + '/del',
            method: 'delete',
            data: JSON.stringify(param),
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            }
        }).then(res => {
            callback(res.data);
        })
    },
    //修改
    updateWareAreaSet(param, callback) {
        axios.request({
            url: API_URL + '/update',
            method: 'put',
            data: JSON.stringify(param),
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            }
        }).then(res => {
            callback(res.data);
        })
    },
    //查询
    getWareAreaSet(param, callback) {
        axios.get(`${API_URL}/query?wareAreaId=${param.wareAreaId}`).then(res => {
            callback(res.data);
        });
    },
};
export default wareAreaSetAPI;